package Controller.CourseServlet;

import Dao.CourseDao;
import bean.Course;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet("/select_course")
public class course_select extends HttpServlet {
    CourseDao courseDao = new CourseDao();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ArrayList<Course> list = courseDao.selectAll();
        req.setAttribute("courseList",list);
        req.getRequestDispatcher("CourseInfoSelect.jsp").forward(req,resp);
    }
}
